#include "GUIPageManager.h"

GUIPageManager::GUIPageManager(void)
{
	PageLogin=new Page_Login();
}

GUIPageManager::~GUIPageManager(void)
{
	delete PageLogin;
}
void GUIPageManager::Update(float dt)
{
	for (std::vector<hgeGUI*>::iterator it=vcPage.begin();it!=vcPage.end();++it)
	{
		(*it)->Update(dt);
	}
}
void GUIPageManager::Render()
{
	for (std::vector<hgeGUI*>::iterator it=vcPage.begin();it!=vcPage.end();++it)
	{
		(*it)->Render();
	}
}
void GUIPageManager::ClosePage(hgeGUI* pPage)
{
	if (!pPage)
	{
		for (std::vector<hgeGUI*>::iterator it=vcPage.begin();it!=vcPage.end();)
		{
			if ((*it)==pPage)
			{
				it=vcPage.erase(it);
			}
			else
				++it;
		}
	}
}
void GUIPageManager::OpenPage(hgeGUI* pPage)
{
	if (pPage)
	{
		ClosePage(pPage);
		vcPage.push_back(pPage);
	}
}